# -*- coding: utf-8 -*-
"""
@Time ： 2023/4/8 16:24
@Auth ： 叶东宇
@File ：deleteSameValue.py
"""

from Chain.Chain import *


def deleteSameValue(chain, value):
    p = chain.head
    chain_ = chain
    while p.next is not None:
        if p.next.value == value:
            p.next = p.next.next
        else:
            p = p.next
    return chain_


if __name__ == "__main__":

    lis = [3,4,5,5,3]
    chain = create_chain_head(lis)
    print(chain.traverse())
    chain_ = deleteSameValue(chain, value=3)
    print(chain_.traverse())